package com.kingdee.bos.webapi.utils;

import java.io.File;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class CfgTools {

	private static Log log = LogFactory.getLog(CfgTools.class.getName());

	private static Object lock = new Object();
	private static boolean initd = false;

	/**
	 * 设置配置文件的默认路径
	 */
	public static void setCfgFilePath() {
		synchronized (lock) {
			if (initd) {
				return;
			}
			//
			String cfgPath = null;
			try {
				String canonicalPath = new File(".").getCanonicalPath();
				cfgPath = canonicalPath + "/../ecology/WEB-INF/prop/kdwebapi.properties";
			} catch (Exception ex) {
				cfgPath = null;
			}
			if (cfgPath != null) {
				log.info("K3Cloud Set CfgFilePath: " + cfgPath);
				CfgUtil.setCfgFilePath(cfgPath);
			}
			initd = true;
		}
	}
}
